<%@Page Language="C#"%>
<%@ Register TagPrefix="Wrox" TagName="PageHeader" Src="/ch7/global/pageheader.ascx"%>
<%@ Register TagPrefix="Wrox" TagName="PageFooter" Src="/ch7/global/pagefooter.ascx"%>
<%@ Import Namespace="System.IO" %>


<Wrox:PageHeader id="header" runat=server />
<script runat=server>

	Hashtable shoppingCart;


	class ShoppingCartItem
	{

		string _productName;
		int _quantityOrdered;

		 public  override int GetHashCode()
		{
			return 1;
		}
	}
	protected void Page_Load( object sender, EventArgs e )
	{

		ShoppingCartItem ci = new ShoppingCartItem();

		Session["value1"] = "Wrox";
		Session["value2"] = "Press";

		Response.Write(Session[0]);

		foreach( string s in Session )
		{
			Response.Write( "<BR>" + s);
		}

		Response.Write( "<HR>");

		Hashtable ourSession;

		// Case sensitive hashtable
		ourSession = new Hashtable();

		// Case insensitive hashtable

		ourSession = new Hashtable( CaseInsensitiveHashCodeProvider.Default,
									CaseInsensitiveComparer.Default	 );

		ourSession["value1"] = "Wrox";
		ourSession["value2"] = "Press";


		ourSession[ci] = "fred";
		string value;


		value = (string) ourSession["value1"];
		value = (string) ourSession["value2"];

		foreach( DictionaryEntry entry in ourSession )
		{
			Response.Write("<BR>Key:" + entry.Key + " Value:" + entry.Value );
		}


		if ( ourSession["Value1"] != null )
		{
			Response.Write("<P>entry found");
		}


		int hashcode;
		string name = "Richard";
		

		hashcode = name.GetHashCode();	
		Response.Write( "Hash code is " + hashcode );
		

		StringDictionary names;
		string surname;

		names = new StringDictionary();
		names["richard"] = "anderson";
		names["alex"] = "homer";

		surname = names["alex"];

		Response.Write("The surname for alex is " + surname );

	
		

	}

</script>

<Wrox:PageFooter id="footer" runat=server />